package com.haina.vote.controller;
import com.github.pagehelper.PageInfo;
import com.haina.vote.entity.IpInfo;
import com.haina.vote.service.ISysLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import java.util.List;

@Controller
@RequestMapping("/syslog")
public class SysLogController {
    @Autowired
    private ISysLogService sysLogService;
    //查询全部访问记录
    @RequestMapping("/findIpInfo.do")
    public ModelAndView findAllIpInfo(@RequestParam(name = "page",required = true,defaultValue = "1")Integer page,@RequestParam(name = "pageSize",required = true,defaultValue = "10")Integer pageSize){
       List<IpInfo> ipInfos = sysLogService.findAllIpInfo(page,pageSize);
        PageInfo pageInfo=new PageInfo(ipInfos);
        ModelAndView mv =new ModelAndView();
        mv.setViewName("syslog-list");
        mv.addObject("pageInfo",pageInfo);
        return mv;
    }
}
